import { Button, Popconfirm, Space, TableColumnsType, Typography } from 'antd'
import type { ITableData } from './types'
export const useIndexColumns = (
  onEdit: (info: ITableData) => void,
  onDel: (id: number) => void,
  params: Record<string, any>,
): TableColumnsType<ITableData> => [
  {
    title: '序号',
    align: 'center',
    dataIndex: '',
    key: '',
    width: 150,
    render: (_, __, index) => {
      return (params.current - 1) * params.size + (index + 1)
    },
  },
  {
    title: '组织名称',
    dataIndex: 'name',
    key: 'name',
    align: 'center',
    render: (info) => {
      return info ? info : '-'
    },
  },
  {
    title: '组织编码',
    dataIndex: 'code',
    key: 'code',
    align: 'center',
    render: (info) => {
      return info ? info : '-'
    },
  },
  {
    title: '组织描述',
    dataIndex: 'des',
    key: 'des',
    align: 'center',
    render: (info) => {
      return info ? info : '-'
    },
  },
  {
    title: '用户状态',
    dataIndex: 'type',
    key: 'type',
    align: 'center',
    render: (info) => {
      return info ? info : '-'
    },
  },
  {
    fixed: 'right',
    title: '操作',
    width: 200,
    align: 'center',
    render: (info) => {
      return (
        <Space size="large">
          <Typography.Link
            onClick={() => {
              onEdit(info)
            }}
          >
            编辑
          </Typography.Link>
          <Typography.Link>启用</Typography.Link>
          <Typography.Link>查看日志</Typography.Link>
        </Space>
      )
    },
  },
]
